<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="net.doglog.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Edit Post</title>
<link rel="stylesheet" type="text/css" href="/admin/style.css" />
</head>
<body>

<ul>
	<li><a href="/">Homepage</a></li>
	<li><a href="/admin">Dashboard</a></li>
	<li><a href="/admin/post">Post List</a></li>
</ul>
<h3>Edit Post</h3>
<%
Post post = (Post) request.getAttribute("post");
if (post == null) {
	BlogUtil.printError(out, Blog.errorNoPostFound);
} else {
%>

<form action="/admin/post/edit/<%= post.getId() %>" method="post">
<%
String title = BlogUtil.attribute(request, "title");
String content = BlogUtil.attribute(request, "content");
String tags = BlogUtil.attribute(request, "tags");
String error = BlogUtil.attribute(request, "error");
%>
<p>
	<label for="title">Title</label><br />
	<input type="text" maxlength="200" name="title" id="title" value="<%= title %>" />
</p>
<p>
	<label for="content">Content</label><br />
	<textarea name="content" id="content"><%= content %></textarea>
</p>
<p>
	<label for="tags">Tags(separated by comma ',')</label><br />
	<input type="text" name="tags" id="tags" value="<%= tags %>" />
</p>
<p>
	<input type="submit" value="Update" />
	<span class="error"><%= error %></span>
</p>
</form>

<%
}	// end if (post == null)
%>
</body>
</html>